<?php
$categoryId     = gpc_getIntPost("Category");
$listname		= gpc_getStringArray("ListName");
$listurl		= gpc_getStringArray("ListUrl");
$listid			= gpc_getStringArray("ListId");
$liststatus		= gpc_getStringArray("liststatus");
$listorder		= gpc_getStringArray("listorder");
//-----------------------------------------------------

if($act=="insertcontent")
{
    foreach($listname as $i=> $name)
    {
    	$sql_insert = "INSERT INTO tblgallery
    					(iParentId,cName,iStatus,cImage,iOrder,cLanguage)
    				VALUE($categoryId,'$name','1','$listurl[$i]',1,'$language')";

    	$dbsql->query($sql_insert);
    }
    page_transfer("Add Images Success !","id=$categoryId");
}
else
{
    foreach($listid as $i=> $idg)
    {
		$sql_update = "UPDATE tblgallery
			 SET
			 cName = '$listname[$i]',
			 iStatus = '$liststatus[$i]',
			 iOrder = ".intval($listorder[$i])."
			 WHERE iId = '$idg'";

		$dbsql->query($sql_update);
    }
    page_transfer("Update Success !",$pagetr);
}
exit();
?>
